:: It is recommended to test the script on a local machine for its purpose and effects. :: ManageEngine Desktop Central will not be responsible for any :: damage/loss to the data/setup based on the behavior of the script. :: Description - Script to configure Windows update active hours. The PC will not automatically restart after updates during active hours. The PC will attempt to restart outside of active hours. :: Script Arguments: (Both value should be lies between 0-23. Mention 0 to represent 12 AM) :: Configuration Type - COMPUTER :: ====================================================================================================== @echo off set argCount=0 for %%x in (%*) do ( set /A argCount+=1 set "argVec[!argCount!]=%%~x" ) if %argCount% LSS 2 ( echo Please Provide Start time and End Time in Script arguments exit 1 ) If %1 GEQ 0 if %1 LSS 24 ( if %2 GEQ 0 if %2 LSS 24 ( reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "SetActiveHours" /t REG_DWORD /d 1 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ActiveHoursStart" /t REG_DWORD /d %1 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ActiveHoursEnd" /t REG_DWORD /d %2 /f ) ) else ( echo Invalid Arguments - Values should lies between 0 - 23 exit 1 )